package test3;

public class demo {
	public static void main(String[] args) {
			String str="this is  a text";
			
			//str中单词单独取出来
			String[] arr=str.split(" +");
			for (String s : arr) {
				System.out.println(s);
			}
			
			System.out.println("==========================");
			//替换
			String str2=str.replace("text", "daa");
			System.out.println(str2);
			
			System.out.println("=====================");
			String str3=str.replace("text", "easrt text");
			System.out.println(str3);
			
			System.out.println("========================");
			for (int i = 0; i < arr.length; i++) {
				char first=arr[i].charAt(0);
				char a=Character.toUpperCase(first);
				
				String str4 =a+arr[i].substring(1);
				System.out.println(str4);

			}
	}

}
